{% extends "master_page.html" %}

{% block title %}<%= get_human_db_ref(@table.TableName) %> listing{% endblock %}
{% block content %}
<script>
function deleteRecord(strKey)
{
    if(confirm("Are you sure?")){
        window.location = "delete?id=" + strKey
    }
}
</script>    
<a href="edit?action=new" class="aNavLink">Add</a>
<table border="0" class="tblList" cellpadding="0" cellspacing="0">
    <tr>
        <td>&nbsp;</td>
		<% for col in @table.Columns %>
        <td><strong><%= get_human_db_ref(col.ColumnName) %></strong></td>
        <% end %>
        <td>&nbsp;</td>
        
    </tr>    
    {% for record in records %}
    <tr>
        <td><a href="edit?id={{record.key}}&action=edit"  class="aNavLink">Edit</a></td>	
        <% for col in @table.Columns %>
        <td>{{record.<%= col.ColumnName %>}}</td>
        <% end %>
        <td><a href="javascript:deleteRecord('{{record.key}}')"  class="aNavLink">Delete</a></td>
    </tr>
    {% endfor %}

</table>
{% endblock %}